package com.lb.ai.common.response.code;

import com.lb.ai.common.response.IResultCode;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 基础响应码模块
 *
 * @author LiuB
 */
public class BaseModule extends ResultCodeModule {
    
    public BaseModule() {
        super(1, "基础模块");
    }
    
    @Getter
    @AllArgsConstructor
    public enum Code implements IResultCode {
        
        // 成功响应
        SUCCESS(200, "操作成功"),
        
        // 客户端错误 4xx
        BAD_REQUEST(400, "请求参数错误"),
        UNAUTHORIZED(401, "暂未登录或token已经过期"),
        FORBIDDEN(403, "没有相关权限"),
        NOT_FOUND(404, "请求的资源不存在"),
        METHOD_NOT_ALLOWED(405, "请求方法不允许"),
        
        // 服务器错误 5xx
        ERROR(500, "服务器内部错误"),
        NOT_IMPLEMENTED(501, "功能未实现"),
        BAD_GATEWAY(502, "网关错误"),
        SERVICE_UNAVAILABLE(503, "服务不可用");
        
        private final Integer code;
        private final String message;
    }
    
    @Override
    public IResultCode[] getCodes() {
        return Code.values();
    }
} 